{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block right %}
<div class="index-body">
{% for p in posts %}
<div class="panel panel-default">
	<div class="panel-heading">
		<h3 class="panel-title">
			<strong>{{ p.topic.topic }}</strong>
		</h3>
	</div>
	<div class="panel-body">
		<div class="post-head">
		<a href="{{ url_for('main.post',id=p.id) }}"><h3 class="text-center">{{ p.head }}</h3></a>
		<h5 class="text-center text-muted" style="margin-bottom: 20px;"><span class="glyphicon glyphicon-calendar"></span> 
		<script>
		var weekday = moment('{{ p.timestamp }}').locale('zh-cn').format('YYYY/MM/DD'); 
		document.write(weekday);
		</script>&nbsp;
		<span class="glyphicon glyphicon-user"></span> {{ p.post_author.username }}&nbsp;
		<span class="glyphicon glyphicon-eye-open"></span> {{ p.clink }} Views	
		</h5>
		</div>
		<div class="post-body">
		&nbsp;&nbsp;&nbsp;&nbsp;{{ (p.body|striptags) }}
		</div>
	</div>
	<div class="panel-footer">
		<p class="text-muted text-right" style="margin-bottom: 0px; font-size: 12px;"><span class="glyphicon glyphicon-tags"></span> <em>TAGGED:</em>
		{% for t in p.tags.all() %}
		<a href="#">{{ t.tag.tag_name }}</a> /
		{% endfor %}
		</p> 
	</div>
</div>
{% endfor %}
{% if data['pagination'] %} 
<div class="pagination">
    {{ macros.pagination_widget(data['pagination'], 'main.home') }}
</div>
{% endif %}
</div>
{% endblock %}